package baseStructure;

/***
 * @author Ragnvald Fuglestein
 */


public class SearchAlbum extends Search {
	private int year = -1;
	private SearchArtist searchartist = null;
	
	public SearchAlbum() {}

	public SearchAlbum(String name) {
		super(name);
	}

	public SearchAlbum(String name, int year) {
		super(name);
		this.year = year;
	}

	public SearchAlbum(int year) {
		this.year = year;
	}
	
	public SearchAlbum(SearchArtist searchartist, String name) {
		super(name);
		this.searchartist = searchartist;
	}

	public SearchAlbum(SearchArtist searchartist, String name, int year) {
		super(name);
		this.year = year;
		this.searchartist = searchartist;
	}

	public SearchAlbum(SearchArtist searchartist, int year) {
		this.year = year;
		this.searchartist = searchartist;
	}

	public SearchArtist getSearchArtist() { return searchartist; }
	
	public boolean matchArtist(Artist artist) {
		
		return false;
	}
	
	/***
	 * 
	 * @param album
	 * @return true if album matches search criteria
	 */
	public boolean matches(Album album) {
		if (year != -1) {
			if (album.getYear() != year) {
				return false;
			}
		}
		if (super.matches(album)) return true;
		
		return false;
	}
	
	public String toString() {
		String str = "";
		str += super.name.toString();
		if (year != -1) str += " - " + year;
		
		return str;
	}
}
